package com.cloudsigns.factorymanager2.engineering.activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.TextView;

import com.cloudsigns.factorymanager2.R;
import com.cloudsigns.factorymanager2.project.utils.ConstantUtil;

public class AddPartrolOrderActivity1 extends Activity implements View.OnClickListener{
    private String TAG=AddPartrolOrderActivity1.class.getSimpleName();
    private View rl_back;
    private TextView tv_title;
    private EditText edt_completion_date;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
        // 沉浸式状态栏
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                    );
            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN

                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.TRANSPARENT);

        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
        setContentView(R.layout.layout_add_partrol_order1);

        init();
    }

    private void init(){
        rl_back = findViewById(R.id.rl_back);
        tv_title = findViewById(R.id.tv_title);
        edt_completion_date=findViewById(R.id.edt_completion_date);

        tv_title.setText("巡查");

        rl_back.setOnClickListener(this);
        edt_completion_date.setOnClickListener(this);

    }

    @Override
    public void onClick(View view) {
        Intent mIntent;
        switch (view.getId()){
            case R.id.rl_back:
                finish();
                break;
            case R.id.edt_completion_date:
                mIntent = new Intent(AddPartrolOrderActivity1.this, TwoDatePickActivity.class);
                mIntent.putExtra(ConstantUtil.KEY_1, TAG);
                startActivityForResult(mIntent, ConstantUtil.START_ACTIVITY_KEY_2);

                break;
        }
    }
}
